package com.znjc.device.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.znjc.common.core.domain.entity.SysDictData;
import com.znjc.device.util.DateUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.sql.Timestamp;
import java.util.List;

/**
 * 磁芯电流采集板
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("iot_cx_data")
public class CxData {

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    /**
     * 数据ids
     */
    private Timestamp ts;
    /**
     * 地址位
     */
    private String dzw;
    /**
     * 电流1
     */
    private String dl1;
    /**
     * 电流2
     */
    private String dl2;
    /**
     * 电流3
     */
    private String dl3;
    /**
     * 电流4
     */
    private String dl4;
    /**
     * 电流5
     */
    private String dl5;
    /**
     * 电流6
     */
    private String dl6;
    /**
     * 电流7
     */
    private String dl7;
    /**
     * 电流8
     */
    private String dl8;
    /**
     * 电流9
     */
    private String dl9;
    /**
     * 电流10
     */
    private String dl10;

    @TableField(exist = false)
    private int type = 0;
    @TableField(exist = false)
    private int maxDlw;
    @TableField(exist = false)
    private List<String> dictData;
    @TableField(exist = false)
    private String tsString;

    public String getTsString(){
        try {
            return DateUtil.TimestampToString(this.getTs());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
